<template>
    <!-- 考试记录表 -->
    <div class="record">
        <h3>考试成绩单</h3>
        <el-table :data="recordList">
            <el-table-column prop="studentId" label="学号"></el-table-column>
            <el-table-column prop="studentName" label="姓名"></el-table-column>
            <el-table-column prop="paperTitle" label="试卷名称"></el-table-column>

            <el-table-column prop="courseName" label="考试科目"></el-table-column>
            <el-table-column prop="teacherName" label="出卷教师"></el-table-column>
            <el-table-column prop="sumScore" label="成绩"></el-table-column>
            <el-table-column prop="useTimeSecond" label="用时">
                <template slot-scope="scope">{{ formatSeconds(scope.row.useTimeSecond) }}</template>
            </el-table-column>
            <!-- <el-table-column prop="useTimeSecond" label="排名">
                <template slot-scope="scope">{{ scope.row.useTimeSecond }}</template>
            </el-table-column> -->
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button
                        type="primary"
                        plain
                        @click="toAnalysis(scope.row)"
                    >{{scope.row.analysisVisible === 1 ? '查看解析' : '' }}</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- <el-pagination
            :current-page="pageIndex"
            :page-sizes="[10, 15,20, 40, 50, 70, 100]"
            :page-size="pageSize"
            :total="totalPage"
            layout="total, sizes, prev, pager, next, jumper"
        ></el-pagination> -->
    </div>
</template>

<script>
import { formatSeconds } from "@/utils";
export default {
    data() {
        return {
            recordList: []
        };
    },
    created() {
        this.$http("/api/exam/getRecordList", {
            params: { studentId: sessionStorage.userId }
        }).then(({ data }) => {
            console.log("data", data);
            this.recordList = data.data;
        });
    },
    methods: {
        formatSeconds(value) {
            return formatSeconds(value);
        },
        toAnalysis(row) {
            if (row.analysisVisible === 0) return;
            this.$router.push({
                path: "/exam/analysis?recordId=" + row.recordId
            });
        }
    }
};
</script>
<style lang="scss">
.record {
    padding: 15px 30px;
    max-width: 1108px;
    margin: 0 auto;
    // margin-top: 100px;
    border: 2px dashed #ccc;
    box-shadow: 0 0 10px #ccc;
     h3 {
        margin-bottom: 10px;
    }
}
</style>
